<?php
Route::group(['prefix' => 'user'], function () {
    Route::get('login', 'User\LoginController@showLoginForm')->name('login');
    Route::post('login', 'User\LoginController@login');
    Route::get('logout', 'User\LoginController@logout')->name('logout');
    Route::get('register', 'User\RegisterController@showRegistrationForm')->name('register');
    Route::post('register', 'User\RegisterController@register');
    Route::get('password/reset', 'User\ForgotPasswordController@showLinkRequestForm')->name('password.request');
    Route::post('password/email', 'User\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
    Route::get('password/reset/{token}', 'User\ResetPasswordController@showResetForm')->name('password.reset');
    Route::post('password/reset', 'User\ResetPasswordController@reset')->name('password.update');
});

//可考虑将email验证的中间件置于该路由定义中
Route::group(['prefix' => 'user', 'middleware' => 'auth'], function () {
    Route::get('email/verify', 'User\VerificationController@show')->name('verification.notice');
    Route::get('email/verify/{id}/{hash}', 'User\VerificationController@verify')->name('verification.verify');
    Route::get('email/resend', 'User\VerificationController@resend')->name('verification.resend');
    Route::group(['middleware' => 'email_verified'], function () {
        Route::get('index', 'User\HomeController@index')->name('user.index');
        Route::put('{user}', 'User\HomeController@update')->name('user.update');
        Route::put('password/{user}', 'User\HomeController@updatepass')->name('user.updatepass');
        Route::put('subject/update', 'User\HomeController@subjectupdate')->name('user.subject.update');
        Route::get('question', 'User\QuestionController@index')->name('user.question.index');
        Route::get('question/{section}/{type?}', 'User\QuestionController@show')->name('user.question.show');
        Route::post('favors', 'User\FavorsController@store')->name('user.favors.store');
        Route::get('favors', 'User\FavorsController@index')->name('user.favors.index');
        Route::get('errors', 'User\ErrorsController@showform')->name('user.question.errors');
        Route::post('errors', 'User\ErrorsController@store');


    });
});
